<?php

namespace app\admin\validate\ucenter;

use think\Validate;


class User extends Validate
{
    protected $rule =   [
        'level_id'  => 'require',
        'username'  => 'require|length:3,25|unique:user',
        'password'  => 'require|length:6,25',
        'email'     =>'email|unique:user',
        'mobile'     =>'mobile|unique:user'
    ];
    protected $message  =   [
        'level_id.require'      => '用户等级必须选择',
        'username.require'      => '用户名不能为空',
        'password.require'      => '密码不能为空',
        'username.length'       => '用户名在3到25个字符之间',
        'password.length'       => '密码在6到25个字符之间',
        'email.email'           => '邮箱格式不正确',
        'username.unique'       => '用户名不能重复',
        'email.unique'       => '邮箱不能重复',
        'mobile.unique'       => '手机号不能重复',
    ];
    protected $scene = [
        'add'  =>  ['level_id','username','password','email','mobile'],
        'edit'  =>  ['level_id','username','email','mobile'],
    ];


}